package com.fc.mall.portal.controller;

import com.alibaba.fastjson.JSONObject;
import com.fc.mall.base.object.Result;
import com.fc.mall.portal.service.UmsMemberService;
import com.fc.mall.vo.MemberFansVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@Api(tags = "MemberFanController", description = "会员粉丝")
@RequestMapping("/member")
public class MemberFanController {

    @Autowired
    private UmsMemberService memberService;

    @ApiOperation("获取当前会员粉丝列表")
    @GetMapping(value = "/fans/list")
    public Result getMemberFans(@RequestParam(value = "pageSize", defaultValue = "1000") Integer pageSize,
                                @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum)
    {
        Map<String, Object> params = new HashMap<>();
        MemberFansVO memberFans = memberService.getMemberFans(params);
        return Result.success(memberFans);
    }

    @ApiOperation("获取当前会员推荐人信息")
    @GetMapping(value = "/myReferrer")
    public Result getMyReferrer()
    {
        JSONObject jsonObject = memberService.getMyReferrer();
        return Result.success(jsonObject);
    }
}
